<template>
  <div class="ad-container">
    <!-- 这里的图片地址可替换成实际的，当前是示例占位 -->
    <img src="https://picsum.photos/1600/400" alt="广告背景图">
    <div class="text-overlay">
      <h1>[快知]</h1>
      <p>
        <span>打</span>
        <span>捞</span>
        <span>思</span>
        <span>想</span>
        <span>的</span>
        <span>锚</span>
        <span>点</span>
      </p>
    </div>
    <div class="ad-label">广告</div>
  </div>
</template>

<script>
export default {
  name: "Advertisement",
  components: {}
}
</script>

<style scoped>
.ad-container {
  position: relative;
  width: 1153px;
  height: 80px;
  overflow: hidden;
  margin-top: 30px;
}

.ad-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.text-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: white;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-shadow: 2px 2px 4px rgba(128, 128, 128, 0.5);
}

.text-overlay h1 {
  font-size: 24px;
  margin-bottom: 5px;
  transition: opacity 0.3s ease;
  margin-top: 0; /* 去除顶部外边距 */
}

.text-overlay p {
  font-size: 16px;
  transition: all 0.3s ease;
  margin: 0;
  display: flex; /* 使用 flex 布局 */
  justify-content: center; /* 水平居中 */
  align-items: center; /* 垂直居中 */
}

.text-overlay p span {
  margin: 0 3px;
}

.ad-label {
  position: absolute;
  top: 5px;
  left: 5px;
  background-color: black;
  color: white;
  padding: 3px 6px;
  font-size: 10px;
}

.ad-container:hover h1 {
  opacity: 0;
}

.ad-container:hover p {
  font-size: 24px;
  font-weight: bold;
  transform: translateY(-60%);

  text-shadow: 2px 2px 4px rgba(128, 128, 128, 0.5);
}
</style>    